/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package commonInfrastructure.system.session;

import java.util.Date;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import commonInfrastructure.system.entity.AuditTrailEntity;

/**
 *
 * @author ReinforceII
 */
@Stateless
@LocalBean
public class AuditTrailSessionBean {
    
    @PersistenceContext
    private EntityManager em;

    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
    public void addAuditTrail (Date date, Long userId, String userName, String module, String process, String action, String notes){
        
        AuditTrailEntity auditTrail = new AuditTrailEntity();
        auditTrail.setDate(date);
        auditTrail.setUserId(userId);
        auditTrail.setUserName(userName);
        auditTrail.setModule(module);
        auditTrail.setProcess(process);
        auditTrail.setAction(action);
        auditTrail.setNotes(notes);
        
        em.persist(auditTrail);
        
    }
    
}
